var timeoutFunction = null;
var index = 0;
var max = false;
var timeout = 10000;
var images = false;

function change_img() {
	if(index < max)
		index++;
	else 
		index = 0;
	images.hide().eq(index).fadeIn('slow');
	timeoutFunction =  setTimeout('change_img()', this.timeout);
}

$(document).ready(function() {
	images = $('.banner-holder .img-banner');
	index = 0;
	max = images.length-1;
	images.hide().eq(index).show();
	change_img();
	
	jQuery("#twitter ul a").live("click", function() { 
				jQuery(this).attr("target","_blank");
			});
	
	
	$("#twitter").getTwitter({
		userName: "nxtri",
		numTweets: 1,
		loaderText: "Loading tweets...",
		slideIn: true,
		showHeading: true,
		headingText: "Latest Tweets",
		showProfileLink: true
	});
	var img_fx = $('.img-banner')
	img_fx.each(function(){
			var me = $(this);
			var img = $('img',me);
			me.css('background', 'url('+img.attr('src')+') no-repeat');
			//me.css('display', 'block');
			//me.height(img.height());
			//me.width(img.width());
			img.hide();
	});
	var videos = $('.vidoes .video');
	videos.not(':first').hide();
	var video_links = $('.vidoes ul a');
	video_links.click(function(){
		videos.hide().filter(this.hash).fadeIn('slow');
		return false;
	});
});
